export default {
  namespaced: true,
  state: {
    projectInfo: {
      projectName: '',
      projectLeader: '', 
      projectId: ''
    },
    productInfo: []
  },
  getters: {
    // 可以添加需要计算的属性
    fullProjectInfo: (state) => {
      return `${state.projectInfo.projectName}（${state.projectInfo.projectId || '无ID'}）`;
    },
    hasProduct: (state) => {
      return !!state.productInfo.productId; // 判断是否有产品信息
    }
  },
  mutations: {
    // 全量更新项目信息（覆盖原有数据）
    SET_PROJECT_INFO(state, payload) {
      state.projectInfo = { ...state.projectInfo, ...payload };
    },
    // 全量更新产品信息（覆盖原有数据）
    SET_PRODUCT_INFO(state, payload) {
      state.productInfo = payload;
    },
    // 清空项目信息
    CLEAR_PROJECT_INFO(state) {
      state.projectInfo = {
        projectName: '',
        projectLeader: '',
        projectId: ''
      };
    },
    // 清空产品信息
    CLEAR_PRODUCT_INFO(state) {
      state.productInfo = [];
    },

  },
  actions: {
   
  }
};